﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CL_SQL.DAL
{
    public class NoticeDAL
    {
        LinqDBDataContext lqDB = new LinqDBDataContext("Data Source=.;Initial Catalog=StudentLoan;Persist Security Info=True;User ID=sa;Password=sa");
        internal List<Notice> AllNotice()
        {
            var r = from d in lqDB.Notice select d;
            return r.ToList<Notice>();
        }

        internal Boolean Add(Notice n)
        {
            try
            {
                lqDB.Notice.InsertOnSubmit(n);
                lqDB.SubmitChanges();
                return true;
            }
            catch (Exception ex)
            {
                return false;
                throw ex;
            }
        }
    }
}
